﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using AspNetCs.Common;
using AspNetCs.Bll;
using AspNetCs.Model;

public partial class Users_SendMessage : BasePage
{
    
    private MessageBLL messageBLL = Message_BLL.CreateNew;

    protected void Page_Load(object sender, EventArgs e)
    {
        CheckUserExit("Login.Aspx?ReUrl=" + configInfo.InstallDir + "Users/Default.aspx", "请您登录", true);
        if(!IsPostBack)
        {
            
        }
    }
    protected void btnSend_Click(object sender, EventArgs e)
    {
        MessageModel model = new MessageModel();

        int UserId = 0;
        UserId = StringHelper.isNumber_int(hldUserId.Value);
        if (UserId==0)
        {
            Page.RegisterStartupScript("showClose","<script>alert('发送失败,收件人不存在!');</script>");
        }
        string title = txtTitle.Text;
        string content = WebEditor1.Text;
        model.Content = content;
        model.Title = txtTitle.Text;
        model.IsDel = 0;
        model.ReciverId = UserId;
        model.ReciverIsMaster = StringHelper.isNumber_int(hldIsAdmin.Value);
        model.SenderId = Base_GetUserInfo.UserId;
        model.SenderIsMaster = 0;
        model.IsAll = 0;
        int i=messageBLL.Add(model);
        Page.RegisterStartupScript("showClose","<script>alert('发送成功!');window.parent.g_close_pop();</script>");

    }
}
